# Building

## Needed tools

- A C99 compiler (like [GCC](https://gcc.gnu.org/) and [Clang](http://clang.llvm.org/))
- [make](https://en.wikipedia.org/wiki/Make_%28software%29)
- [CMake](https://cmake.org/)

## Needed libraries

### Standard library

Of course, you need a C99 standard library.
But if you have a C99 compiler, you have probably corresponding standard library.
Otherwise, we advise you to use [GNU's one](https://www.gnu.org/software/libc/).

### SDL2 and some of its extensions

- [SDL (Simple DirectMedia Layer)](https://libsdl.org/) version 2
- [SDL2_gfx](http://cms.ferzkopp.net/index.php/software/13-sdl-gfx)
- [SDL2_image](https://www.libsdl.org/projects/SDL_image/)

You can download and compile them with `make static-libs`.
If you choose this option, the links to SDL2 and some of its extensions will be static.
It is great if you can not install shared libraries in a good way.

If you can install shared libraries cleanly, we recommend you to install them.
You can compile them for source or get a build for your operating system.
If you are running on Debian or Trisquel GNU/Linux, with SuperUser rights, you can install the libraries with `apt-get install libsdl2-dev libsdl2-gfx-dev libsdl2-image-dev`.

## Steps

0. `make static-libs # if needed`
1. `make externals/core # if needed`
2. `mkdir -p build`
3. `cd build`
4. `cmake ..`
5. `make`

## Operating System tested

- GNU/Linux
  - [Trisquel GNU/Linux](https://trisquel.info/) 7 "Belenos"
  - [Debian](https://www.debian.org/) GNU/Linux 8 "Jessie"
  - Ubuntu GNU/Linux 14.04 LTS
- Apple OS X 10.8

## Tests

Some tests are done with [cppcheck](http://cppcheck.sourceforge.net/) and [vera++](https://bitbucket.org/verateam/vera/wiki/Home).
To test all of them, you can use `make tests`.

## Continuous Integration

- [GitLab CI](.gitlab-ci.yml)
- [Travis CI](.travis.yml)
